﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;

public partial class entry_introduce : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string Cname = Request.QueryString["Cname"];
        Label1.Text = Cname;
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string Cno = Request.QueryString["Cno"];
        string conn = "Data Source= . ;Initial Catalog=XSXK; User ID=sa; pwd=123";
        SqlConnection connection = new SqlConnection(conn);

        try
        {
            connection.Open();
            SqlCommand comm = new SqlCommand();
            comm.Connection = connection;


            string str_sql = " update Course set Course.introduce='" + TextBox1.Text+ "' where Course.Cno='"+Cno+"' ";
            comm.CommandText = str_sql;
            comm.ExecuteNonQuery();          

            Response.Write("<h1>成功添加课程介绍！</h1>");

        }

        catch (SqlException ex)
        {
            Response.Write(ex.Message);
        }

        connection.Close();//关闭数据库连接
    }
}